<%if not in_sdcms then response.write("template load fail"):response.end() end if%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="{sdcms[seokey]}" />
<meta name="Description" content="{sdcms[seodesc]}" />
<title>{sdcms[webname]}</title>
<link href="{webroot}lib/css/base.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/public.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_base.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_bind.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_reg.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_login.css" rel="stylesheet" type="text/css" />
<script>var webroot="{webroot}";</script>
<script src="{webroot}lib/js/jquery.js"></script>
<script src="{webroot}lib/js/jquery-migrate-1.1.0.min.js"></script>
<script src="{webroot}lib/tips/jquery.tips.js"></script>
<script src="{webroot}lib/js/base.js"></script>
<script src="{webroot}lib/js/mobile.js"></script>
<script src="{webroot}lib/validator/jquery.validator.js"></script>
<script src="{webroot}lib/validator/zh_CN.js"></script>
<script src="{webroot}theme/default/js/sdcms.js"></script>
<script>
$(function(){
	$(".form_bind").validator(
	{
		stopOnError:true,
		theme:'yellow_right_effect',
		ignore:':hidden',
		beforeSubmit:function(){
			$("input[type='submit']").attr("disabled",true);
		},
		valid:function(form)
		{
			$.fn.tips({type:'loading',content:'数据提交中'});
			$.ajax(
			{
				url:"?act=bind",
				type:"post",
				data:$(form).serialize(),
				success:function(data){
					data=jQuery.parseJSON(data);
					var type="warn";
					if(data.status=="y"){type="ok";}
					$.fn.tips({type:type,content:data.info});
					if(data.status=="y"){
						var gourl=$("#bind_url").attr("value");
						if(gourl==""){gourl="../../"}
						setTimeout(function(){location.href=gourl},1000);
					}
					$("input[type='submit']").attr("disabled",false);
				}
			});
		},
		invalid:function(){$("input[type='submit']").attr("disabled",false);}
	});
	
	$(".c_password").blur(function(){
	var value=$(this).val();
	var box=$('#strength');
	if (value==''||value==null){
		box.removeClass().addClass('nothing').text('');
		return false;
	} else if (value.length<6){
		box.removeClass().addClass('nothing').text('密码过短');
	} else {
		var score=passwordGrade(value);
		if (score<11){
			box.removeClass().addClass('nothing').text('不安全');
		} else if (score<21){
			box.removeClass().addClass('strength normal').text('安全程度：低');
		} else if (score<31){
			box.removeClass().addClass('strength general').text('安全程度：中');
		} else if (score>30){
			box.removeClass().addClass('strength special').text('安全程度：高');
		}
	}
	});
	
	$(".form_reg").validator(
	{
		stopOnError:true,
		theme:'yellow_right_effect',
		ignore:':hidden',
		beforeSubmit:function(){
			$("input[type='submit']").attr("disabled",true);
		},
		valid:function(form)
		{
			$.fn.tips({type:'loading',content:'数据提交中'});
			$.ajax(
			{
				url:"?act=db",
				type:"post",
				data:$(form).serialize(),
				success:function(data){
					data=jQuery.parseJSON(data);
					var type="warn";
					if(data.status=="y"){type="ok";}
					$.fn.tips({type:type,content:data.info});
					if(data.status=="y")
					{
						var act=data.info.substring(0,1);
						var info=data.info.substring(1);
						switch(act)
						{
							case "1":
								$.fn.tips({type:"ok",content:info,time:10000});
								break;
							case "2":
								$.fn.tips({type:"ok",content:info,time:5000});
								break;
							case "3":
								$.fn.tips({type:"ok",content:info,time:2000});
								var gourl=$("#gourl").attr("value");
								if(gourl==""){gourl="../../"}
								if(gourl.indexOf("login.asp")!=-1||gourl.indexOf("reg.asp")!=-1){gourl="../../"}
								$.fn.tips({type:"ok",content:info});
								setTimeout(function(){location.href=gourl},2500);
								break;
							default:
								alert(_);
								break;
						}
						$("input[type='submit']").attr("disabled",false);
					}
				}
			});
		},
		invalid:function(){$("input[type='submit']").attr("disabled",false);}
	});
		
})

</script>
</head>

<body>
    {sdcms:include("../sdcms_head.asp")}
    
    <div id="position">
    <div></div>
您所在的位置：<a href="{webroot}">首页</a> > 账户绑定</div>
    <div class="w980 mt10 mc">
        <div class="w900 bt">
            <ul class="bind_menu">
                <li class="hover" id="one1" onclick="setTab('one',1,2)">创建新账户</li>
                <li id="one2" onclick="setTab('one',2,2)">绑定已有账户</li>
            </ul>
            <div class="c block">
                <div class="welcome">{nickname}，欢迎您</div>
                <div id="con_one_1">
                {if sdcms[isreg]}
                   <form class="form_reg" method="post">
                   <ul id="reg">
                       <li><em>密码：</em><input type="password" name="password" class="ip w01 c_password" data-rule="密码:required;password;" maxlength="16" /></li>
                       <dd><div id="strength"></div></dd>
                       <li><em>确认密码：</em><input type="password" name="repass" class="ip w01" data-rule="确认密码:required;password;match(password)" maxlength="16" /></li>
                       <li><em>昵称：</em><input name="nickname" type="text" class="ip w01" value="{nickname}" maxlength="10" data-rule="昵称:required;nickname" /></li>
                       <li><em>电子邮箱：</em><input type="text" name="email" class="ip w01" data-rule="电子邮箱:required;email;remote[{webroot}user/ajax.asp?act=email];" maxlength="50" /></li>
                       <li><em>验证码：</em><input type="text" name="imgcode" class="ip w02" maxlength="4" data-rule="验证码:required;remote[{webroot}user/ajax.asp?act=imgcode];" /> <img src="{webroot}lib/imgcode.asp?t0=80&t1=20" title="看不清楚？点击刷新！" align="absmiddle" id="imgcode" onClick="this.src+='&'+Math.random();" /><span for="imgcode" class="msg-box"></span></li>
                       <dd><input type="hidden" id="gourl" value="{api_backurl}" /><input type="submit" value="完成注册" class="bnt_blue" /></dd>
                   </ul>
                   </form>
                   {else}
                       {sdcms[userclose]}
                   {/if}
                </div>
                <div id="con_one_2" class="dis">
                <form class="form_bind" method="post">
                <ul id="login">
                    <li>账户：<input type="text" name="username" class="ip" data-rule="账户:required;username;" /></li>
                    <li>密码：<input type="password" name="password" class="ip" data-rule="密码:required;password;" /></li>
                    <li class="p42"><input type="hidden" id="bind_url" value="{api_backurl}" /><input type="submit" value="绑定账户" class="bnt_blue" /></li>
                </ul>
                </form>
                
                </div>
            </div>
        </div>
    </div>
    {sdcms:include("../sdcms_foot.asp")}